<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function zfCs(str) {
            var obj = {};
            for (var i = 0; i < str.length; i++) {
                if (obj[str[i]]) {
                    obj[str[i]]++
                } else {
                    obj[str[i]] = 1;
                }
            }
            console.log(obj);
            var max = 0;
            var maxK = '';
            for (var k in obj) {
                if (obj[k] > max) {
                    max = obj[k];
                    maxK = k;
                }
            }
            console.log('该字符串出现最多的字符是' + maxK + ' 出现的次数是' + max + '次');

        }
        var str1 = 'guecyeyicuekxwkhdshdhdhdhhdhdhhh';
        zfCs(str1);
    </script>
</head>

<body>

</body>

</html>